<?
    $busca = $_SESSION['busca'];
?>
<div id="topo">
	<div>
		<div>
			<h1 id="logo">
				<a href="./"><img src="./include/img/logo.png" alt="sharethismap" /></a>
			</h1>
			
			<ul id="acoes">
				<? if(in_array("busca", $menu)){ ?>
					<li class="item-acoes">
						<img class="icone" src="./include/img/busca.png" alt="Buscar" title="Buscar"/>
					</li>
				<? } ?>
			</ul>
		</div>
	</div>	
	<div id="curva-menu"></div>
	<ul id="menu-acoes">
		<? if(in_array("busca", $menu)){ ?>
			<li class="item-acao">
				<div class="conteudo">
					<h2>Buscar</h2>
					<div class="inner-conteudo">
						<form id="buscaForm" action="busca" method="post">
							Busca: <input id="buscaInput" maxlength="100" type="text" name="busca" value="<?=$busca?>"/> 
							<input type="button" onclick="submitBusca();" value="Buscar" id="buscaIr" class="bt"/>
							<span id="erroBusca"></span>
						</form>
						
						<? if(isset($semIrPara) && !$semIrPara){ ?>
							<span>Ir para:</span>
							<input type="text" name="irpara" onkeyup="codeAddress(this.value);"/>
						<? } ?>	
					</div>
				</div>
			</li>
		<? } ?>
	</ul>	
</div>
	
<br class="clear" />

<script type="text/javascript">    
    function submitBusca()
    {
		buscaForm = document.getElementById('buscaForm');
		query = document.getElementById("buscaInput").value;
		erroBusca = document.getElementById("erroBusca")

		msg_erro = "Preencha esse campo por favor."

		if(query == '')
			erroBusca.innerHTML = msg_erro;
		else
			buscaForm.submit();
		
    }
</script>